import {global} from '../Main';
import {BaseScene} from 'BaseScene';
export class Menu extends BaseScene{
    /**
     * 只需要实现此方法，将playground的代码粘贴到此方法即可;
     * @returns
     */
    public iniScene(){
        //注意添加这两行，以匹配playground里的代码
        var engine = global.engine;
        var canvas = global.canvas;
        var scene = this.scene;
        var THIS = this;

        var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -10), scene);

        // This targets the camera to scene origin
        camera.setTarget(BABYLON.Vector3.Zero());
    
        // This attaches the camera to the canvas
        camera.attachControl(canvas, true);

        var advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("UI");
        var panel = new BABYLON.GUI.StackPanel();
        advancedTexture.addControl(panel);
        var createBtn = function(sceneN:SCENE) {
            var text = SCENE[sceneN];
            var btn = BABYLON.GUI.Button.CreateSimpleButton("btn"+text, text);
            btn.width = 0.1;
            btn.height = "40px";
            btn.cornerRadius = 20;
            btn.color = "Orange";
            btn.thickness = 4;
            btn.background = "green";
            btn.paddingTop = "5px"
            panel.addControl(btn);  
            
            btn.onPointerClickObservable.add(function() {
                THIS.askForRender(sceneN);
            });
            return btn;
        }
    
        createBtn(SCENE.Demo1)//.horizontalAlignment = BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_RIGHT;
        createBtn(SCENE.Demo3)//.horizontalAlignment = BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
    
        createBtn(SCENE.Room1)//.verticalAlignment = BABYLON.GUI.Control.VERTICAL_ALIGNMENT_TOP;
        createBtn(SCENE.MainScene)//.verticalAlignment = BABYLON.GUI.Control.VERTICAL_ALIGNMENT_BOTTOM;
    }
}